﻿using Prism.Ioc;
using L2_RegisterType.Views;
using System.Windows;
using L2_RegisterType.Models;
using L2_RegisterType.Interfaces;
using L2_RegisterType.ViewModels;

namespace L2_RegisterType
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 注册类型

            #region 注册瞬态类型
            // containerRegistry.Register<Student>(); // 方式一
            containerRegistry.Register<IHuman, Student>();
            #endregion

            #region 注册单例类型
            // containerRegistry.Register<User>();
            containerRegistry.Register<IUser, User>();
            #endregion

            #region 注册实例
            // containerRegistry.RegisterInstance(new Company());
            containerRegistry.RegisterInstance<ILocation>(new Company());
            #endregion

            #region 注册弹窗
            containerRegistry.RegisterDialog<MsgView, MsgViewModel>();
            #endregion

            #region 注册导航
            containerRegistry.RegisterForNavigation<ViewA, ViewAViewModel>();
            #endregion
        }
    }
}